//
//  SMHomeTableViewCell.m
//  ShoppingMall
//
//  Created by Demon on 2018/3/21.
//  Copyright © 2018年 Demon. All rights reserved.
//

#import "SMHomeTableViewCell.h"

@implementation SMHomeTableViewCell

- (void)setHomeTableViewModel:(SMProductModel *)model {
    [self.prdImageView sd_setImageWithURL:[NSURL URLWithString:model.smallimg]];
    self.prdTitleLb.text = model.title;
    self.currentPriceLb.text = model.price;
    
    NSString *salesNum;
    if ([model.sales integerValue] < 10000) {
        salesNum = [NSString stringWithFormat:@"%@件",model.sales];
    } else {
        float num = [model.sales integerValue]/10000.0;
        salesNum = [NSString stringWithFormat:@"%.2f万件",num];
    }
    self.salesNumberLb.text = salesNum;
    self.offPercentPriceLb.text = model.coupon;
}

- (IBAction)shareBtnClick:(UIButton *)sender {
    if (self.shareBtnClick) {
        self.shareBtnClick(self.indexPathCell);
    }
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
